\(\int \frac {a+b x^2}{1+x^2} \, dx\) [107]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 12 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x+(a-b) \arctan (x) \]

[Out]

b*x+(a-b)*arctan(x)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {396, 209} \[ \int \frac {a+b x^2}{1+x^2} \, dx=(a-b) \arctan (x)+b x \]

[In]

Int[(a + b*x^2)/(1 + x^2),x]

[Out]

b*x + (a - b)*ArcTan[x]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps \begin{align*} \text {integral}& = b x-(-a+b) \int \frac {1}{1+x^2} \, dx \\ & = b x+(a-b) \tan ^{-1}(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x+(a-b) \arctan (x) \]

[In]

Integrate[(a + b*x^2)/(1 + x^2),x]

[Out]

b*x + (a - b)*ArcTan[x]

Maple [A] (verified)

Time = 2.62 (sec) , antiderivative size = 13, normalized size of antiderivative = 1.08

method result size
default \(b x +\left (a -b \right ) \arctan \left (x \right )\) \(13\)
risch \(b x +a \arctan \left (x \right )-b \arctan \left (x \right )\) \(14\)
meijerg \(\frac {b \left (2 x -2 \arctan \left (x \right )\right )}{2}+a \arctan \left (x \right )\) \(17\)
parallelrisch \(b x -\frac {i \ln \left (x -i\right ) a}{2}+\frac {i \ln \left (x -i\right ) b}{2}+\frac {i \ln \left (x +i\right ) a}{2}-\frac {i \ln \left (x +i\right ) b}{2}\) \(41\)

[In]

int((b*x^2+a)/(x^2+1),x,method=_RETURNVERBOSE)

[Out]

b*x+(a-b)*arctan(x)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x + {\left (a - b\right )} \arctan \left (x\right ) \]

[In]

integrate((b*x^2+a)/(x^2+1),x, algorithm="fricas")

[Out]

b*x + (a - b)*arctan(x)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.08 (sec) , antiderivative size = 26, normalized size of antiderivative = 2.17 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x - \frac {i \left (a - b\right ) \log {\left (x - i \right )}}{2} + \frac {i \left (a - b\right ) \log {\left (x + i \right )}}{2} \]

[In]

integrate((b*x**2+a)/(x**2+1),x)

[Out]

b*x - I*(a - b)*log(x - I)/2 + I*(a - b)*log(x + I)/2

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x + {\left (a - b\right )} \arctan \left (x\right ) \]

[In]

integrate((b*x^2+a)/(x^2+1),x, algorithm="maxima")

[Out]

b*x + (a - b)*arctan(x)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b x + {\left (a - b\right )} \arctan \left (x\right ) \]

[In]

integrate((b*x^2+a)/(x^2+1),x, algorithm="giac")

[Out]

b*x + (a - b)*arctan(x)

Mupad [B] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.00 \[ \int \frac {a+b x^2}{1+x^2} \, dx=b\,x+\mathrm {atan}\left (x\right )\,\left (a-b\right ) \]

[In]

int((a + b*x^2)/(x^2 + 1),x)

[Out]

b*x + atan(x)*(a - b)